
@extends('home.inc.common')
@section('title')
    <title>{{ $anchor->name }}官方直播间地址_{{ $anchor->name }}微博地址_{{ $anchor->name }}视频_{{ $anchor->name }}最新动态_奇异果聚合-看点有意思的</title>
    <meta name="keywords" content="{{ $anchor->name }}，{{ $anchor->name }}直播间地址，{{ $anchor->name }}视频" />
    <meta name="description" content="{{ $anchor->name }}官方直播间地址.奇异果聚合全网追踪主播动态，帮助收录整理{{ $anchor->name }}微博地址，{{ $anchor->name }}视频，{{ $anchor->name }}最新动态、{{ $anchor->name }}最新视频，在奇异果您可以订阅主播，任何平台主播在线立即微信提醒，马上来试试吧…" />
    <link href="{{asset('home_new/css/libs.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/global.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/page_ub_detail.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/qyg2016.css')}}" rel="stylesheet" type="text/css" />

    <link href="{{asset('home/js/skin/layer.css')}}" type="text/css" rel="stylesheet" />
    <link href="{{asset('home_new/css/loginPop.css')}}" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="{{asset('home/js/jquery-3.1.0.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('pulgin/layer/layer.js')}}"></script>
    <script src="http://static.geetest.com/static/tools/gt.js"></script>
    <link rel="icon" href="{{asset('home_new/favicon.ico')}}" />
@endsection
@section('content')
    <div class="wrap">
        <div id="main" class="post_wrap">
            @include('home.anchor.common-cates')
            <div class="media_content">
                <div class="content_video">
                    <div class="video_nav">
                        <a href="{{ url('/') }}">
                            首页
                        </a>
                        &nbsp;&nbsp;>&nbsp;&nbsp;
                        <a href="{{ route('anchor.index') }}">
                            直播
                        </a>
                        &nbsp;&nbsp;>&nbsp;&nbsp;
                        @if (!empty($anchor->cate))
                            <a href="{{ route('anchor.cate', [$anchor->cate->cate_id]) }}">
                                {{$anchor->cate->cate_name}}
                            </a>
                            &nbsp;&nbsp;>&nbsp;&nbsp;
                        @endif
                        <span class="nav_curr">
								{{ $anchor->room_name }}
                    </span>
                    </div>
                    <div class="video_title">
                        <div class="video_ub">
                            <div class="video_ub_pic">
                                <img src="{{ $anchor->avatar }}" alt="" width="92">
                            </div>
                            <div class="video_ubtitle">
                                <h2>{{ $anchor->room_name }}</h2>
                                <span class="video_ubname">{{ $anchor->name }}</span>
                                <span class="video_ubgz">{{ num2word($anchor->online) }}</span>
                                <div class="video_nbfx icon25">
                                    @foreach($tag->attributes()->orderBy('sort','asc')->get() as $attr)
                                        <span>
                                            <a href="{{ $attr->link }}"  target="_blank" rel="nofollow" title="{{ $attr->name }}">
                                                <img src="{{ route('image', [$attr->icon, '45x45']) }}">
                                            </a>
                                        </span>
                                    @endforeach
                                </div>
                            </div>
                            <div class="viseo_ubfx">
                                <span>
                                <a  class="ub_csm" href="{{$anchor->url}}" target="_blank" rel="nofollow">传送门</a>

                                @if (empty($user) || ! $user->isFollowedAnchor($anchor))
                                    <button class="ub_gzbtn
                                    @if(empty($user))
                                        login_in
                                    @elseif(!$user->isBindWx())
                                        bind_wx
                                    @endif"
                                    id="follow" onclick="follow()">关注</button>
                                @else
                                    <button class="ub_gzybtn" id="unfollow" onclick="unfollow()">已关注</button>
                                @endif
                                </span>
                                <div class="bdsharebuttonbox ub_detail_btn">
                                    <a href="#" class="bds_more" data-cmd="more"></a>
                                    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
                                    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
                                    <a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
                                    <a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
                                    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
                                </div>
                                <script>
                                    window._bd_share_config = {
                                        common : {
                                            bdText : '{{ $anchor->room_name }}',
                                            bdDesc : '{{ $tag->content }}',
                                            bdUrl : 'http://www.qiyiguo.tv/anchors/{{ $tag->id }}',
                                            bdPic : '{{ $anchor->cover }}'
                                        },
                                        share : [{
                                            "bdSize" : 24
                                        }]
                                    }
                                    with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
                                </script>

                            </div>

                        </div>
                    </div>
                    <div class="video_post">
                        <div class="post_player clear" style="border: 1px solid #ddd;">
                            <div class="player_screen">
                                {!! $anchor->live_stream !!}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content_more">
                    <div class="post_description">
                        <p class="des_title">
                            推荐理由
                        </p>
                        <p class="des_content">
                        {!!  $tag->content  !!}
                        <p>
                    </div>
                    <div class="more_side clear">
                        <div class="side_left">
                            <div class="item">
                                <a href="http://weibo.com/u/5897732591" target="_blank" rel="nofollow"><img src="{{asset('home_new/images/article_foot_qrcode.jpg')}}" /></a>
                            </div>
                            <div class="cmWrap">
                                @include('inc.comment', ['archive' => $tag])
                            </div>
                        </div>
                        <div class="side_right">
{{--                            <h3>
                                标签
                            </h3>
                            <div class="right_tag">
                                @foreach($tag->getSimilars() as $t)
                                    <a href="{{ $t->url }}">
                                        {{ $t->name }}
                                    </a>
                                @endforeach
                            </div>--}}
                            <h3 style="height:54px; line-height:54px;">
                                推荐主播
                            </h3>
                            <ul class="right_recommend">
                                @foreach($rec_anchors->take(4) as $rec)
                                    <li>
                                        <a href="{{ route('anchor.show', [$rec->id]) }}">
                                            <img src="{{ $rec->cover }}"
                                                 alt="{{ $rec->room_name }}" />
                                            <span class="recommend_cover">
											</span>
                                            <span class="recommend_title">
												{{ $rec->room_name }}
											</span>
                                        </a>
                                    </li>
                                @endforeach
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        var $follow_url = '{{ route('anchor.follow', [$anchor->id]) }}';
        var $is_bind_url = '{{ route('wx.is-bind') }}';
        var $is_subscribe_url = '{{ route('wx.is-subscribe') }}';

        var box = $('.viseo_ubfx span');

        var follow_btn = $('.ub_gzbtn');

        var unfollow = function () {
            //询问框
            layer.confirm('取消关注将不会返还积分！', {
                btn: ['确认','取消'],
                title : '确认取消关注',
                icon: 3
            }, function(){
                var room_url = "{{$anchor->url}}";
                var load_index = layer.load(1, {time: 10*1000});
                $.getJSON($follow_url, function (res) {
                    if (res.error == 1) box.html('<a  class="ub_csm" href="'+room_url+'" target="_blank" rel="nofollow">传送门</a><button class="ub_gzbtn" id="follow" onclick="follow()">关注</button>');
                    layer.close(load_index);
                    layer.alert(res.msg, {
                        icon: res.error
                    })
                });

            });
        };

        window.weixinCallback = function ()
        {
            layer.close(bind_wx);
            var load_index = layer.load(1, {time: 10*1000});
            $.getJSON($is_subscribe_url, function (res) {
                layer.close(load_index);

                if (res == "0") {
                    layer.alert('<p style="text-align: center;"><img src="{{ asset('img/weixin_qrcode.jpg') }}" width="150" /> <p>关注微信公众号，即可收到主播上线通知！</p></p>');
                } else {
                    layer.confirm('关注将扣除100积分', {
                        btn: ['确认','取消'],
                        title : '确认关注',
                        icon: 1
                    }, function(){
                        var room_url = "{{$anchor->url}}";
                        load_index = layer.load(1, {time: 10*1000});
                        $.getJSON($follow_url, function (res) {
                            if (res.error == 1) box.html('<a  class="ub_csm" href="'+room_url+'" target="_blank" rel="nofollow">传送门</a><button class="ub_gzybtn" id="unfollow" onclick="unfollow()">已关注</button>');
                            layer.close(load_index);
                            layer.alert(res.msg, {
                                icon: res.error
                            })
                        });

                    });
                }
            });
        }

        var　follow = function () {

            if (follow_btn.hasClass('login_in')) return;

            var load_index = layer.load(1, {time: 10*1000});

            $.getJSON($is_bind_url, function (res) {
                layer.close(load_index);

                if (res == "0") {
                    window.bind_wx = layer.confirm('绑定微信并关注奇异果公众号后你喜欢的主播上线时将会第一时间通知你哦~', {
                        btn: ['去绑定微信', '取消'],
                        title : '绑定微信',
                        icon: 3
                    }, function(){
                        layer.close(bind_wx);
                        window.bind_wx = layer.open({
                            type: 2,
                            border: [0],
                            title: false,
                            shadeClose: true,
                            closeBtn: true,
                            area: ['830px' , '400px'],
                            content: '{{url('auth/wxBind/').'/'.$anchor->id}}'
                        });
                    });
                } else {
                    load_index = layer.load(1, {time: 10*1000});
                    $.getJSON($is_subscribe_url, function (res) {
                        layer.close(load_index);

                        if (res == "0") {
                            layer.alert('<p style="text-align: center;"><img src="{{ asset('img/weixin_qrcode.jpg') }}" width="150" /> <p>关注微信公众号，即可收到主播上线通知！</p></p>');
                        } else {
                            layer.confirm('关注将扣除100积分', {
                                btn: ['确认','取消'],
                                title : '确认关注',
                                icon: 1
                            }, function(){
                                var room_url = "{{$anchor->url}}";
                                load_index = layer.load(1, {time: 10*1000});
                                $.getJSON($follow_url, function (res) {
                                    if (res.error == 1) box.html('<a  class="ub_csm" href="'+room_url+'" target="_blank" rel="nofollow">传送门</a><button class="ub_gzybtn" id="unfollow" onclick="unfollow()">已关注</button>');
                                    layer.close(load_index);
                                    layer.alert(res.msg, {
                                        icon: res.error
                                    })
                                });

                            });
                        }
                    });
                }

            });
        };
    </script>
@endsection